<template>
  <div>
    <edu-page-tabs :tab-list="xTabs" />
    <el-container>
      <el-aside width="200px">账号信息</el-aside>
      <el-main>
        <el-form label-width="120px" size="mini">
          <el-form-item label="用户名:">{{ response.user_name }}</el-form-item>
        </el-form>
      </el-main>
    </el-container>
    <el-divider />
    <el-container>
      <el-aside width="200px">商品信息</el-aside>
      <el-main>
        <el-form label-width="120px" size="mini">
          <el-form-item label="商品名称:">{{ response.title }}</el-form-item>
          <el-form-item label="商品价格:"><money :value="response.cash_price" /></el-form-item>
          <el-form-item label="积分抵扣:">{{ response.credit_price }}</el-form-item>
          <el-form-item v-if="!response.fictitious" label="商品运费:"><money :value="response.carriage" /></el-form-item>
        </el-form>
      </el-main>
    </el-container>
    <el-divider />
    <el-container>
      <el-aside width="200px">订单信息</el-aside>
      <el-main>
        <el-form label-width="120px" size="mini">
          <el-form-item label="订单号:">{{ response.order_no }}</el-form-item>
          <el-form-item label="数量:">{{ response.ext_data.num }}</el-form-item>
          <el-form-item label="支付金额:"><money :value="response.payment" /></el-form-item>
          <el-form-item label="抵扣积分:">{{ response.credit.credit }}</el-form-item>
          <el-form-item label="下单时间:">{{ response.create_time }}</el-form-item>
          <el-form-item label="支付时间:">{{ response.payment_time }}</el-form-item>
        </el-form>
      </el-main>
    </el-container>
    <el-divider v-if="!response.fictitious" />
    <el-container v-if="!response.fictitious">
      <el-aside width="200px">地址信息</el-aside>
      <el-main>
        <el-form label-width="120px" size="mini">
          <el-form-item label="收货人:">{{ response.addrinfo.consignee }}</el-form-item>
          <el-form-item label="收货人手机号:">{{ response.addrinfo.phone }}</el-form-item>
          <el-form-item label="收货人地址:">{{ response.addrinfo.areatext }} {{ response.addrinfo.address }}</el-form-item>
        </el-form>
      </el-main>
    </el-container>
  </div>
</template>

<script>
import EduPageTabs from '@public/template/tabs/page_tabs.vue';
import Money from './components/form_money.vue';

export default {
  components: {
    Money,
    EduPageTabs
  },
  inject: ['reload'],
  data() {
    return {
      xTabs: [
        {
          title: '订单列表',
          uri: '/mall/order/list',
          meta: {
            permission: 'mall.order.list'
          }
        },
        {
          title: '订单详情',
          uri: '/mall/order/' + this.$route.params.order_no + '/detail',
          meta: {
            permission: 'mall.order.list.detail'
          }
        }
      ],
      response: {}
    };
  },
  created() {
    this.$http.get(
      '/mall/admin/order/' + this.$route.params.order_no + '/detail',
      {},
      response => {
        this.response = response.data;
        console.log(this.response);
      },
      _ => {
        this.$message.error('请求出错');
      }
    );
  },
  methods: {}
};
</script>
<style scoped>
.el-aside {
  background-color: #d3dce6;
  color: #333;
  display: flex;
  justify-content: center;
  align-items: center;
}

.el-main {
  background-color: #e9eef3;
  color: #333;
  display: flex;
  justify-content: flex-start;
  align-items: center;
}
.el-form-item {
  margin-bottom: 0;
}
.reason-btns {
  margin-top: 20px;
}
</style>
